1 Type Classes Without Types ∗

نویسندگان

  • Ronald Garcia
  • Andrew Lumsdaine
چکیده

Data-directed programs consist of collections of generic functions, functions whose underlying implementation differs depending on properties of their arguments. Scheme’s flexibility lends itself to developing generic functions, but the language has some shortcomings in this regard. In particular, it lacks both facilities for conveniently extending generic functions while preserving the flexibility of ad-hoc overloading techniques and constructs for grouping related generic functions into coherent interfaces. This paper describes and discusses a mechanism, inspired by Haskell type classes, for implementing generic functions in Scheme that directly addresses the aforementioned concerns. Certain properties of Scheme, namely dynamic typing and an emphasis on block structure, have guided the design toward an end that balances structure and flexibility. We describe the system, demonstrate its function, and argue that it implements an interesting approach to polymorphism and, more specifically, overloading.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Structural Type Inference in Java-like Languages

In the past we considered type inference for Java with generics and lambdas. Our type inference algorithm determines nominal types in subjection to a given environment. This is a hard restriction as separate compilation of Java classes without relying on type informations of other classes is impossible. In this paper we present a type inference algorithm for a Java-like language, that infers st...

متن کامل

A Classification of Intersection Type Systems

The first system of intersection types. Coppo and Dezani [3], extended simple types to include intersections and added intersection introduction and elimination rules ((ΛI ) and (ΛE) ) to the type assignment system. The major advantage of these new types was that they were invariant under β-equality, later work by Barendregt, Coppo and Dezani [1], extended this to include an (η) rule which gave...

متن کامل

Constructive Type Classes in Isabelle

We reconsider the well-known concept of Haskell-style type classes within the logical framework of Isabelle. So far, axiomatic type classes in Isabelle merely account for the logical aspect as predicates over types, while the operational part is only a convention based on raw overloading. Our more elaborate approach to constructive type classes provides a seamless integration with Isabelle loca...

متن کامل

Type Inference for Overloading without Restrictions, Declarations or Annotations

This article presents a type system based on the DamasMilner system [DM82], that supports overloading. Types of overloaded symbols are constrained polymorphic types. The work is related to Haskell type classes [Wad89,NP93,HHJW96], System O [OWW95] and other type systems with similar forms of constrained types [Kae88,Smi91,Jon94,DCO96]. Restrictions imposed in these systems with respect to overl...

متن کامل

A Type System for Computer Algebra

This paper presents a type system for support of subtypes, parameterized types with sharing and categoriesin a computeralgebra environment.By modelingrepresentationof instances in terms of existential types, we obtain a simpliied model, and build a basis for deening subtyping among algebraic domains. The inheritance at category level has been formalized; this allows the automatic inference of t...

متن کامل

Enumerated Types in Java

SUMMARY Java does not contain enumerated types. This paper demonstrates how to produce classes that behave like enumerated types with secure, strong typing. Additional Pascal-like operations are easily incorporated into the enumerated types without repeating code. Full listings of the classes are given.

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2005